home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Shutdown FX 2.1 / source / Gestalt function ƒ / sfx gestalt function.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.2 KB  |  70 lines  |  [TEXT/KAHL]

  1. #include "sfx gestalt equ.h"
  2.  
  3. pascal OSErr main(OSType gestaltSelector, long *gestaltResponse)
  4. {
  5.     long            theValue;
  6.     
  7.     asm
  8.     {
  9.         bra.s    @4
  10.     @1    dc.l    0            /* will store address of fade here */
  11.     @2    dc.l    0            /* will store address of shutdown proc here */
  12.     @3    dc.l    0            /* will store address of restart proc here */
  13.     @4
  14.     }
  15.     
  16.     switch (gestaltSelector)
  17.     {
  18.         case sfxGetFadeProcPtr:
  19.             asm
  20.             {
  21.                 move.l    @1, theValue
  22.             }
  23.             *gestaltResponse=theValue;
  24.             return noErr;
  25.         case sfxGetShutdownProcPtr:
  26.             asm
  27.             {
  28.                 move.l    @2, theValue
  29.             }
  30.             *gestaltResponse=theValue;
  31.             return noErr;
  32.         case sfxGetRestartProcPtr:
  33.             asm
  34.             {
  35.                 move.l    @3, theValue
  36.             }
  37.             *gestaltResponse=theValue;
  38.             return noErr;
  39.         case sfxGetFadeProcPtrAddress:
  40.             asm
  41.             {
  42.                 lea        @1, a0
  43.                 move.l    a0, theValue
  44.             }
  45.             *gestaltResponse=theValue;
  46.             return noErr;
  47.         case sfxGetShutdownProcPtrAddress:
  48.             asm
  49.             {
  50.                 lea        @2, a0
  51.                 move.l    a0, theValue
  52.             }
  53.             *gestaltResponse=theValue;
  54.             return noErr;
  55.         case sfxGetRestartProcPtrAddress:
  56.             asm
  57.             {
  58.                 lea        @3, a0
  59.                 move.l    a0, theValue
  60.             }
  61.             *gestaltResponse=theValue;
  62.             return noErr;
  63.         case sfxGetVersion:
  64.             *gestaltResponse=1L;
  65.             return noErr;
  66.     }
  67.     
  68.     return -1;
  69. }
  70.